<?php
defined('_XR_EXEC') or die();
/**
* Controller基类
*
*/
class controller{
	
	
	function __construct(){
		
		# 输送一些模式的url参数
		$wwwroot = url::base();
		$pathpart = url::base(false);
		
		$this->assign('G_path',$wwwroot);
		$this->assign('G_pathpart',$pathpart);	
		$this->assign('themeUrl',$pathpart);	
			
	}


  //暂存变量
	public function assign($name, $value = null) {
		
		if (is_array($name)) {
			foreach ($name as $k => $v) {
				R::singleton()->data[$k] = $v;
			}
		} else {
			R::singleton()->data[$name] = $value;
		}
	}


	//关闭模板页面的输出
	public function disableView(){
		R::singleton()->view_display = false;
	}
	//打开模板页面的输出
	public function openView(){
		R::singleton()->view_display = true;
	}
	
	public function gets(){
		return R::singleton()->gets;
	}
	public function posts(){
		return R::singleton()->posts;
	}
	
//重定向模板的controller和view
//	public function openView(){
//		R::singleton()->view_display = true;
//	}
	
}
?>
